package me.cloud.ids.jap.utils;

import com.fujieid.jap.http.JapHttpCookie;
import com.fujieid.jap.http.JapHttpRequest;
import com.fujieid.jap.http.JapHttpResponse;
import com.fujieid.jap.http.JapHttpSession;
import com.fujieid.jap.http.adapter.jakarta.JakartaCookieAdapter;
import com.fujieid.jap.http.adapter.jakarta.JakartaRequestAdapter;
import com.fujieid.jap.http.adapter.jakarta.JakartaResponseAdapter;
import com.fujieid.jap.http.adapter.jakarta.JakartaSessionAdapter;
import lombok.experimental.UtilityClass;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @Description:
 * @author: Sylar
 * @date: 2021年12月02日 3:01 下午
 */
@UtilityClass
public class HttpUtil {

    public JapHttpRequest wrap(HttpServletRequest request) {
        return new JakartaRequestAdapter(request);
    }

    public JapHttpResponse wrap(HttpServletResponse response) {
        return new JakartaResponseAdapter(response);
    }

    public JapHttpCookie wrap(Cookie cookie) {
        return new JakartaCookieAdapter(cookie);
    }

    public JapHttpSession wrap(HttpSession session) {
        return new JakartaSessionAdapter(session);
    }
}
